package com.burges.net.dataStream.codeRuler.transform.SingleDataStream

import org.apache.flink.api.java.tuple.Tuple
import org.apache.flink.streaming.api.scala.{KeyedStream, StreamExecutionEnvironment,_}

/**
  * 创建人    BurgessLee 
  * 创建时间   2020/1/26 
  * 描述     KeyBy使用
  */
object KeyByFunctionDemo {

	def main(args: Array[String]): Unit = {
		val environment = StreamExecutionEnvironment.getExecutionEnvironment

		val dataStream = environment.fromElements((1,5),(2,2),(2,4),(1,3))
		//指定第一个字段分区key
		val keyedStream: KeyedStream[(Int, Int), Tuple] = dataStream.keyBy(0)

		keyedStream.print()

		environment.execute("streaming KeyByOperation")
	}

}
